import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main5 {
    public static void main(String[] args) {
	        Scanner in = new Scanner(System.in);
	        ArrayList strList=new ArrayList<>();
	        String str1=in.next();
	        for(int i=0;i<str1.length();i++)
	        {
	        	 String[] str=str1.split(" ");
	        	 while(!str1.equalsIgnoreCase("!!end!!"))
	        	 {
	        		 strList.add(str);
	        		 System.out.println(strList);
	        	 }
	        }
	       
	        strList.add(0,"begin");
	        strList.add(strList.size(),"end");
	       System.out.println(strList);
	    }
	}

